﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUS.ISS.ARS.BusinessComponent;
using NUS.ISS.ARS.BusinessEntity;
using NUS.ISS.ARS.BusinessFacade.Interface;
using NUS.ISS.ARS.Common;
using NUS.ISS.ARS.BusinessEntity.ViewModels;

namespace NUS.ISS.ARS.BusinessFacade
{
    public class AdminBF : IAdminBF
    {
        private AircraftBC _aircraftBC;
        private FlightScheduleBC _flightScheduleBC;
        private CountryBC _countryBC;
        private FlightBookingBC _flightBookingBC;

       public AdminBF()
        {
            _aircraftBC = new AircraftBC();
            _flightScheduleBC = new FlightScheduleBC();
            _countryBC = new CountryBC();
            _flightBookingBC = new FlightBookingBC();
        }

        #region Aircraft
        public ICollection<Aircraft> GetAllAircraft()
        {
            return _aircraftBC.GetAllAircraft();
        }
        public IEnumerable<Aircraft> IEnumGetAllAircraft()
        {
            return _aircraftBC.IEnumGetAllAircraft();
        }
        public SaveResult SaveAircraft(Aircraft aircraft)
        {
            return _aircraftBC.SaveAircraft(aircraft);
        }
        #endregion

        #region Flight Schedule
        public ICollection<FlightSchedule> GetAllFlightSchedules()
        {
            return _flightScheduleBC.GetAllFlightSchedules();
        }
        public IEnumerable<FlightScheduleView> IEnumGetAllFlightSchedules()
        {

            return _flightScheduleBC.IEnumGetAllFlightSchedules();
        }
        public FlightScheduleView GetFlightSchedulesById(long id)
        {
            return _flightScheduleBC.GetAllFlightScheduleById(id);
        }        
        public IEnumerable<FlightScheduleView> GetFlightSchedulesByFlightNumberAirport(string flightNumber, string airportFrom, string airportTo)
        {
            return _flightScheduleBC.GetFlightSchedulesByFlightNumberAirport(flightNumber, airportFrom, airportTo);
        }
        public IEnumerable<FlightScheduleView> GetFlightSchedulesByFlightDateFlightNumberCityFromCityTo(DateTime flightdate, string flightNumber, string cityFrom, string cityTo)
        {
            return _flightScheduleBC.GetFlightSchedulesByFlightDateFlightNumberCityFromCityTo(flightdate, flightNumber, cityFrom, cityTo);
        }



        #endregion

        public ICollection<Country> GetAllCountries()
        {
            return _countryBC.GetAllCountries();
        }
        public IEnumerable<Airport> IEnumGetAllAirport()
        {
            return _flightScheduleBC.IEnumGetAllAirport();
        }
        public SaveResult SaveChangedSchedule(FlightScheduleView schedule)
        {
            return _flightScheduleBC.SaveChangedSchedule(schedule);
        }
        public SaveResult SaveSchedule(FlightScheduleView schedule)
        {
            return _flightScheduleBC.SaveSchedule(schedule);
        }

        public IEnumerable<CancelBookingTripView> IEnumGetFlightBookings()
        {
            return _flightBookingBC.IEnumGetFlightBookings();
        }
        #region FlightBooking
        public IEnumerable<CancelBookingTripView> GetFlightBookingsByRefNoAndFirstNameAndLastName(string refNo, string firstName, string lastName)
        {
            return _flightBookingBC.GetFlightBookingsByRefNoAndFirstNameAndLastName(refNo, firstName, lastName);
        }

        #endregion
    }
}
